#include <xtos.h>

#define CSR_PRMD 0x1
#define CSR_ERA 0x6
#define CSR_PRMD_PPLV (3UL << 0)
#define CSR_PRMD_PIE (1UL << 2)

void main() {
	mem_init();     /* 内存初始化 */
	con_init();     /* 初始化控制台 */
	disk_init();
	excp_init();    /* 初始化时钟中断 */
	process_init();
	int_on();       /* 使能全局中断 */
	asm volatile(
		"csrwr %0, %1\n"
		"csrwr $r0, %2\n"
		"li.d $sp, %3\n"
		"ertn\n"
		:
		: "r"(CSR_PRMD_PPLV | CSR_PRMD_PIE), "i"(CSR_PRMD), "i"(CSR_ERA), "i"(VMEM_SIZE));
}
